<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2021/9/28
  Time: 11:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path=request.getContextPath()+"/";%>
<html>
<head>
    <base href="<%=path%>">
    <title>系统日志</title>
    <link href="hplus-master//css/bootstrap.min.css?v=3.3.7" rel="stylesheet"/>
    <link href="hplus-master//css/font-awesome.min.css?v=4.4.0" rel="stylesheet"/>
    <link href="hplus-master/css/animate.css" rel="stylesheet"/>
    <link href="hplus-master/css/style.css?v=4.1.0" rel="stylesheet"/>
    <link href="hplus-master/css/jquery.contextMenu.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <link href="https://cdn.jsdelivr.net/npm/jquery-treegrid@0.3.0/css/jquery.treegrid.css" rel="stylesheet">
    <link href="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.css" rel="stylesheet">
</head>
<style>
    header{
        height: 60px;
        box-shadow: 1px 1px 3px rgb(0 0 20%);
        border: 1px solid grey;
        border-radius: 4px;
        margin: 10px 10px ;
        background-color: white;
        line-height: 60px;
        padding-left: 20px;
    }
    body{
        background-color: #f3f3f4;
    }
    #conter{
        height:80%;
        box-shadow: 1px 1px 3px rgb(0 0  20%);
        border: 1px solid grey;
        border-radius: 4px;
        margin: 10px 10px ;
        background-color: white;
        padding-left: 10px;
        padding-right: 10px;
    }
</style>
<body>

<header>
    <form class="form-inline" id="queryForm" >
        <div class="form-group">
            <label for="exampleInputName2">操作名称</label>
            <input type="text" class="form-control" name="moduleName" id="exampleInputName2" placeholder="请输入操作名称模糊查询">
        </div>


        <button type="button"   onclick="$.refresh()" class="btn btn-primary query"><i class="fa fa-search"></i>&nbsp;查询</button>
        <button type="reset"  class="btn btn-warning "><i class="fa fa-refresh"></i>&nbsp;重置</button>
    </form>
</header>
<div id="conter">
    <div class="fixed-table-toolbar">
        <div id="toolbar">
            <button type="button" class="btn btn-info add" onclick="$.operator.openWin('新增操作信息','opera/toEdit')"><i class="fa fa-plus"></i>新增</button>
            <!-- Indicates caution should be taken with this action -->
            <button type="button" id="edit" disabled="disabled" class="btn btn-warning  edit "  ><i class="fa fa-edit"></i>编辑</button>
            <!-- Indicates a dangerous or potentially negative action -->
            <button type="reset" id="deletes" disabled="disabled" class="btn btn-danger  deletes " ><i class="fa fa-trash-o"></i>删除选中</button>

        </div>
    </div>
    <table id="table"></table>

</div>


</body>

<!-- 全局js -->
<script src="hplus-master/js/jquery.min.js?v=2.1.4"></script>
<script src="hplus-master/js/bootstrap.min.js?v=3.3.7"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
<script src="hplus-master/js/plugins/layer/layer.min.js"></script>
<script src="https://unpkg.com/tableexport.jquery.plugin/tableExport.min.js"></script>
<<script src="https://cdn.jsdelivr.net/npm/jquery-treegrid@0.3.0/js/jquery.treegrid.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.18.3/dist/extensions/treegrid/bootstrap-table-treegrid.min.js"></script>
<script src="js/qs.js"></script>
<script>
    let options={
        height: 400,
        url:"opera/data",
        columns: [
            {
                field : 'checked',
                checkbox: true,
                align: 'center',
                valign: 'middle',
                title: 'ids',
                formatter:function(value,row,index) {//设置满足条件的行可以使用复选框
                    this.value='operId'
                }
            }
            ,{
                field: 'moduleName',
                sortable:true,
                title: '操作'
            }, {
                field: 'moduleType',
                title: '操作业务',

            },  {
                field: 'userId',
                title: '操作人ID',

            },{
                title:'操作',
                width:'120px',
                align:'center',
                formatter:function(value,row,index){
                    let userId=row.operId;

                    return '<a  href="javascript:void(0)"  title="編輯" onclick="$.operator.openWin(\'编辑操作信息\',\'opera/toEdit?operId='+userId+'\');"><i class="fa fa-edit"></i></a>&nbsp;&nbsp;'+'<a  href="javascript:void(0)" onclick="delById('+userId+')" title="刪除"><i class="fa fa-trash-o"></i></a>&nbsp;&nbsp;';
                }
            }]
    }
    $.initTable(options);
    function delById(userId){

        layer.confirm('是否删除', {icon: 3, title:'提示'}, function(index){
            //do something
            $.modal.delete_("opera/deletes?ids="+userId);
        })
        $.refresh();
    }

    $(function(){

        // 工具栏上的编辑
        $(".edit").click(function(){
            let data = $("#table").bootstrapTable('getSelections');
            if(data.length!=1){
                layer.msg('请选择需要修改的记录');
                return;
            }
            let userId = data[0].operId;
            $.operator.openWin('编辑操作信息','opera/toEdit?operId='+userId)
        });
        $(".deletes").click(function () {
            let data = $("#table").bootstrapTable('getSelections');
            if(data.length==0){
                layer.msg('请选择需要删除的数据');
                return;
            }
            layer.confirm("确定需要删除"+data.length+"条数据吗？",function(){
                let param="?1=1";
                for(let i=0;i<data.length;i++){
                    param+="&ids="+data[i].operId;
                }
                $.modal.delete_('opera/deletes'+param);
            });
        });

        $(".resetButton").click(function(){
            $("#queryForm")[0].reset();
            $("#deptId").val(-1);
        })
    })
    function close(){
        $.refresh();
        layer.close(index);
    }
    function refresh(){
        $.refresh();
    }

</script>
</body>

</html>
